

<template>
  <router-view  v-slot="{ Component }">
    <keep-alive :include="keepAlive">
      <component :is="Component" />
    </keep-alive>
  </router-view>
</template>

<script setup>
import { computed } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter()
const keepAlive = computed(() => {
  let keep = []
  router.options.routes.forEach(rt => {
    if (rt.meta.keepAlive) {
      keep.push(rt.name)
    }
  });
  return keep
})
  
</script>

<style scoped>
</style>
